package com.butterfly.hotkey.core.rule;

import com.butterfly.hotkey.core.enums.CacheDurationEnum;

/**
 * client key的配置信息
 * client端关注 keyPattern
 * worker端关注 intervalInSec 和 threshold
 *
 * @author butterfly
 * @since 2024/10/19
 */
public class ClientKeyRule {
    /**
     * key的正则匹配模式，也可以完全和key相同。为"*"时代表通配符
     */
    private String keyPattern;

    /**
     * 间隔时间（秒）
     */
    private int intervalInSecs;

    /**
     * 累计数量
     */
    private int threshold;

    /**
     * 变热key后，本地、etcd缓存它多久
     *
     * @see CacheDurationEnum
     */
    private String duration;

    /**
     * 描述
     */
    private String desc;

    public String getKeyPattern() {
        return keyPattern;
    }

    public void setKeyPattern(String keyPattern) {
        this.keyPattern = keyPattern;
    }

    public int getIntervalInSecs() {
        return intervalInSecs;
    }

    public void setIntervalInSecs(int intervalInSecs) {
        this.intervalInSecs = intervalInSecs;
    }

    public int getThreshold() {
        return threshold;
    }

    public void setThreshold(int threshold) {
        this.threshold = threshold;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
